From 8e41e1c94b39e97ce22fdfa6332bfd326dc316af Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 31 May 2005 08:22:44 +0000 Subject: [PATCH] bitkeeper revision 1.1601 (429c1ed4wKexKmX-ibC6x3hHrciDNQ) Fix CPU detection and initialisation. We now do early detection very early, but pushed full initialisation to somewhat later when other infrastructure is properly ready. Signed-off-by: Keir Fraser --- xen/arch/x86/apic.c | 3 +-- xen/arch/x86/cpu/common.c | 1 + xen/arch/x86/setup.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 684a180540..dea77354a2 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -493,14 +493,13 @@ custom_param("apic_verbosity", apic_set_verbosity); static int __init detect_init_APIC (void) { u32 h, l, features; - extern void get_cpu_vendor(struct cpuinfo_x86*); /* Disabled by kernel option? */ if (enable_local_apic < 0) return -1; /* Workaround for us being called before identify_cpu(). */ - get_cpu_vendor(&boot_cpu_data); + /*get_cpu_vendor(&boot_cpu_data); Not for Xen */ switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 145ef6187f..8b319f1a1b 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -223,6 +223,7 @@ void __init early_cpu_detect(void) c->x86_mask = tfms & 15; if (cap0 & (1<<19)) c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; + c->x86_capability[0] = cap0; /* Added for Xen bootstrap */ } early_intel_workaround(c); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index d1d89ef4a3..bd21c5bb18 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -85,7 +85,7 @@ extern void early_cpu_init(void); extern unsigned long cpu0_stack[]; -struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 }; +struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; #if defined(CONFIG_X86_64) unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE; @@ -144,6 +144,8 @@ static void __init start_of_day(void) { int i; + early_cpu_init(); + /* Unmap the first page of CPU0's stack. */ memguard_guard_stack(cpu0_stack); @@ -161,14 +163,6 @@ static void __init start_of_day(void) GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE, virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR); - /* Process CPU type information. */ - early_cpu_init(); - identify_cpu(&boot_cpu_data); - if ( cpu_has_fxsr ) - set_in_cr4(X86_CR4_OSFXSR); - if ( cpu_has_xmm ) - set_in_cr4(X86_CR4_OSXMMEXCPT); - find_smp_config(); smp_alloc_memory(); @@ -199,6 +193,12 @@ static void __init start_of_day(void) scheduler_init(); + identify_cpu(&boot_cpu_data); + if ( cpu_has_fxsr ) + set_in_cr4(X86_CR4_OSFXSR); + if ( cpu_has_xmm ) + set_in_cr4(X86_CR4_OSXMMEXCPT); + if ( opt_nosmp ) max_cpus = 0; smp_prepare_cpus(max_cpus); -- 2.30.2